package com.ls.demo.http.config;

import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.annotation.Resource;

/**
 * @author liShan
 * @date 2019/8/28 16:02
 */
@Configuration
public class HttpBeanConfig {

    @Resource
    private HttpServerProperties httpServerProperties;

    @Bean
    public EventLoopGroup httpBossEventLoopGroup(){
        return new NioEventLoopGroup(httpServerProperties.getBossNioEventLoopGroupSize());
    }

    @Bean
    public EventLoopGroup httpWorkEventLoopGroup(){
        return new NioEventLoopGroup(httpServerProperties.getWorkNioEventLoopGroupSize());
    }

    @Bean
    public ServerBootstrap httpServerBootstrap(){
        return new ServerBootstrap();
    }



}
